<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTableCallRecord extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('call_record', function (Blueprint $table) {
            $table->increments('id')->comment('主键');
            $table->string('serviceSn', 32)->comment('唯一标识');
            $table->string('accessTime')->comment('被叫开始接入时间');
            $table->string('endTime')->comment('呼叫结束时间');
            $table->tinyInteger('recStatus')->comment('接听状态：1 接通、-1 主叫主动挂机、-2 被叫电话不应答、-3 系统平台错误');
            $table->string('city')->nullable()->comment('市');
            $table->string('startTime')->comment('呼叫开始时间');
            $table->string('extension')->comment('分机号码');
            $table->string('inOrOut')->comment('呼入呼出类型：inbound 呼入、outbound 呼出');
            $table->unsignedInteger('transferId')->nullable()->comment('转接节点id');
            $table->unsignedInteger('duration')->comment('通话时长，单位（秒）');
            $table->string('province')->nullable()->comment('省');
            $table->string('account')->comment('企业400号码');
            $table->string('callingid')->comment('主叫号码');
            $table->string('calledid')->comment('被叫号码');
            $table->string('recordUrl')->comment('录音下载地址');
            $table->timestamps();

            $table->charset = 'utf8';
            $table->collation = 'utf8_unicode_ci';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('call_record');
    }
}
